/**
  ******************************************************************************
  * @file 
  * @brief 
  * @author Moon
  * @version V1.0.0
  * @date 2022/09/18
  ******************************************************************************
  */
#ifndef _DRV_F4_CAN_H
#define _DRV_F4_CAN_H 

#include "drv_include.h"

/* private config -----------------------------------------------------------*/
typedef struct
{
    CAN_TypeDef *pcan;
}can_private_t;

/* Public defines -----------------------------------------------------------*/
typedef struct drv_can drv_can_t;

/* Public enum    -----------------------------------------------------------*/
typedef enum 
{
    CAN_STD = 0,    //标准帧
    CAN_EXT,        //扩展帧
} FRM_TYPE_e;
/* Public Struct  -----------------------------------------------------------*/
struct drv_can
{
    /* ***************Public Parameter  *************** */
    const char *DRV;        //设备名称
    const char *Tx_Pin;     //发送引脚
    const char *Rx_Pin;     //接收引脚

    FRM_TYPE_e type;        //帧类型
    uint32_t CANID;         //CAN ID
    uint32_t mack;          //子网掩码
    uint32_t baut;          //波特率
    uint32_t clk;           //CAN时钟频率
    uint16_t Rx_Priority;   //中断优先级
    void (*RxCallBack)(uint32_t id, uint8_t *buf, uint32_t len);    //接收回调
    /* ***************Public Method     *************** */
    void (*Send)(drv_can_t *this, uint32_t id, uint8_t *buf, uint32_t len);
    /* ***************Private Attributes*************** */
    can_private_t private;
};

/* Public Variable  ---------------------------------------------------------*/
//Pointer

//Array

//Const



/* Pubilc function prototypes -----------------------------------------------*/
int Drv_Can_Init(drv_can_t *this);
	
#endif

